package user_mapping

import (
	"context"

	"algo-sdk-go/project/matchmaking/matchMaking-api/internal/svc"
	"algo-sdk-go/project/matchmaking/matchMaking-api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type SetRecommendUserLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewSetRecommendUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SetRecommendUserLogic {
	return &SetRecommendUserLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *SetRecommendUserLogic) SetRecommendUser(req *types.SetRecommendUserRequest) (resp *types.SetRecommendUserResponse, err error) {
	if err = l.svcCtx.MatchService.SyncRecommend(l.ctx, req.RecommendList); err != nil {
		return nil, err
	}

	resp = &types.SetRecommendUserResponse{
		Data: types.SetRecommendUserData{
			Result: true,
		},
	}
	return
}
